package com.example.controller;

import com.example.dto.CategoryDTO;
import com.example.pojo.Category;
import com.example.pojo.PageBean;
import com.example.pojo.Result;
import com.example.service.CategoryService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/cates")
@RequiredArgsConstructor
public class CategoryController {

    private final CategoryService categoryService;

    @GetMapping
    public Result find(CategoryDTO categoryDTO) {
        log.info("分页参数，参数:{}", categoryDTO);
        PageBean<Category> pageBean = categoryService.find(categoryDTO);
        return Result.success(pageBean);
    }
}
